class SimulationEngine:
    def __init__(self):
        self.__control1 = []    # The controls used in every step
        self.__control2 = []    # The controls used in some step
        
    def run(self, mol, ff, energy, n, *args, **kwargs):
        for i in range(n):
            for j in self.__control1:
                j.run(self, mol, ff, energy, i, *args, **kwargs)
            for j in self.__control2:
                while j[2] < i:
                    j[0].run(self, mol, ff, energy, i, *args, **kwargs)
                    j[2] += j[1]

    def use(self, control, steps = 1):
        if steps == 1:
            self.__control1.append(control)
        else:
            self.__control2.append((control, steps, 0))
            
    def clear(self):
        self.__control1.clear()
        self.__control2.clear()
